﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DBService;
using YArchitech.Controls;
using HYRMEOpening;

namespace YArchitech.Revit.MEP.Opening
{
	public partial class DlgNewOpening : System.Windows.Forms.Form
	{
		public DlgNewOpening(DlgOpeningDetect dco)
		{
			this.mainFrom = dco;
			this.InitializeComponent();
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			if (this.rbCircle.Checked)
			{
				this.SectionParameter = new SectionParameter(Convert.ToDouble(this.tbDuctWallD.Text));
				this.BoxParameter = new BoxParameter(0.0);
				return;
			}
			this.SectionParameter = new SectionParameter(Convert.ToDouble(this.tbDuctWallT.Text), Convert.ToDouble(this.tbDuctWallB.Text));
			this.BoxParameter = new BoxParameter(0.0, 0.0, 0.0, 0.0);
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		private void rbCircle_CheckedChanged(object sender, EventArgs e)
		{
			if (this.rbCircle.Checked)
			{
				this.tbDuctWallT.Enabled = false;
				this.tbDuctWallB.Enabled = false;
				this.tbDuctWallL.Enabled = false;
				this.tbDuctWallR.Enabled = false;
				this.tbDuctWallD.Enabled = true;
			}
		}

		private void rbRect_CheckedChanged(object sender, EventArgs e)
		{
			if (this.rbRect.Checked)
			{
				this.tbDuctWallT.Enabled = true;
				this.tbDuctWallB.Enabled = true;
				this.tbDuctWallL.Enabled = true;
				this.tbDuctWallR.Enabled = true;
				this.tbDuctWallD.Enabled = false;
			}
		}

		private DlgOpeningDetect mainFrom;

		public BoxParameter BoxParameter;

		public SectionParameter SectionParameter;
	}
}
